<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:s="http://jboss.com/products/seam/taglib"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:rich="http://richfaces.org/rich"
	xmlns:a="http://richfaces.org/a4j"
	template="/customers/customers-frame.xhtml">

	<ui:param name="pageTitle"
		value="#{messages['page.customers.index.title']}" />

	<ui:define name="subheader">#{messages['page.customers.index.subheader']}</ui:define>

	<ui:define name="main">
		<a:form id="personListForm">

			<rich:extendedDataTable value="#{personBean.getAll()}" var="customer"
				sortMode="single" rows="20"
				onRowMouseOver="this.className='extdt-row-selected'"
				onRowMouseOut="this.className=''" id="personListTable">
				<f:facet name="header">
					<h:panelGroup>
						<h:commandLink action="personCreate"
							style="float:left; background-color: transparent;">
							<h:outputText value="#{messages['customer.create']}" />
						</h:commandLink>
					</h:panelGroup>
				</f:facet>

				<rich:column sortable="true" sortBy="#{customer.firstname}"
					filterBy="#{customer.firstname}"
					label="#{messages['person.firstname']}" width="25%">
					<f:facet name="header">#{messages['person.firstname']}</f:facet>
					<h:outputText value="#{customer.firstname}" />
				</rich:column>

				<rich:column sortable="true" sortBy="#{customer.lastname}"
					filterBy="#{customer.lastname}"
					label="#{messages['person.lastname']}" width="25%">
					<f:facet name="header">#{messages['person.lastname']}</f:facet>
					<h:outputText value="#{customer.lastname}" />
				</rich:column>

				<rich:column sortable="true" sortBy="#{customer.pesel}"
					filterBy="#{customer.pesel}" label="#{messages['person.pesel']}"
					width="25%">
					<f:facet name="header">#{messages['person.pesel']}</f:facet>
					<h:outputText value="#{customer.pesel}" />
				</rich:column>

				<rich:column label="#{messages['address']}" width="25%">
					<f:facet name="header">#{messages['person.address']}</f:facet>
					<h:outputText value="#{customer.address.street} - #{customer.address.postcode} #{customer.address.city}" />
				</rich:column>

				<a:support event="onRowClick"
					action="#{personBean.setSelectedPerson(customer)}" />

				<f:facet name="footer">
					<rich:datascroller for="personListTable"
						id="personListTableScroller" />
				</f:facet>
			</rich:extendedDataTable>
		</a:form>

	</ui:define>
</ui:composition>
